/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javafx179labs.nez.hr.bean;

/**
 *
 * @author SSheypak
 */

public class Department extends ObjHashId implements ObjHasName {
    private String title;
    //use alt+insert for code generation

    public Department() {

    }
    
    public Department(Integer id, String title) {
        this.id = id;
        this.title = title;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Override
    public String getName() {
        return title;
    }

    public void setName(String title) {
        this.title = title;
    }

    @Override
    //unique attr = id
    public boolean equals(Object obj) {
        if (obj == null) { //null :)
            return false;
        }
        if (getClass() != obj.getClass()) { //must be the same class
            return false;
        }
        final Department other = (Department) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    //read hashcode and hashmap in Java
    public int hashCode() {
        int hash = 5;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString(){
        return "Department{id["+id+"] title["+title+"]}";
    }
}
